import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)


// 定义路由组件
import mainroute from '@/views/main/route'

import Notfind from '@/views/errorpages/route'
import film from '@/views/shop/route'
import site from '@/views/site/route'


// 将login引入到全局
import login from '@/views/login/route'

const routes = [
  {
    // 默认进入页面
    path:'/',
    redirect: {name:'home'}
  },
  ...site,
  ...film,
  ...mainroute,
  ...Notfind,
  ...login,
  {
    path:'*',redirect: "/404"
  },
  {
    path:'/logincode',
    name:'logincode',
    component: () => import('@/views/login/logincode.vue')
  }
]


const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
